****************************************
* Table B3: Democrat Vote Share U.S. House: Main Specification
******************************************

preserve
use "$input/prec-hur", clear
xtset group

gen treatment = treatment50
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3a.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",) replace dec(3)
drop cmean coef percent treatment
local foo 


gen treatment = treatment100
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3a.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",)  append dec(3)
drop cmean coef percent treatment
local foo 

gen treatment = treatment200
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3a.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",)  append dec(3)
drop cmean coef percent treatment
local foo 


gen treatment = treatment300
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3a.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",)  append dec(3)
drop cmean coef percent treatment
local foo 


gen treatment = treatment400
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3a.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",)  append dec(3)
drop cmean coef percent treatment
local foo 

gen treatment = treatment500
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3a.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",)   dec(3) append tex
drop cmean coef percent treatment
local foo 

use "$input/prec-major-hur", clear
xtset group

gen treatment = treatment50
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3b.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",) replace dec(3)
drop cmean coef percent treatment
local foo 


gen treatment = treatment100
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3b.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",)  append dec(3)
drop cmean coef percent treatment
local foo 

gen treatment = treatment200
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3b.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",)  append dec(3)
drop cmean coef percent treatment
local foo 


gen treatment = treatment300
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3b.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",)  append dec(3)
drop cmean coef percent treatment
local foo 


gen treatment = treatment400
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3b.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",)  append dec(3)
drop cmean coef percent treatment
local foo 

gen treatment = treatment500
qui xtreg demohouseshare_total treatment i.year i.stateid, fe cl(group)
qui gen coef=_b[treatment]
qui sum demohouseshare_total if treatment==0 & e(sample)
qui gen cmean = r(mean)
qui gen percent = coef/cmean * 100
local mean1 = round(cmean, 0.001)
local percent1 = round(percent, 0.001) 
outreg2 using "$output/tabb3b.doc",   addtext("Control Mean =", "`mean1'", "Effect  =", "`percent1'",)   dec(3) append tex
drop cmean coef percent treatment
local foo 
restore


